<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"	
	xmlns:p="http://primefaces.org/ui"
	xmlns:hmrSearch="http://java.sun.com/jsf/composite/search"	
	xmlns:hmrDetail="http://java.sun.com/jsf/composite/detail">	
	
	<p:dialog id="findExerciseGroup" header="#{msgs.FindExerciseGroup}" widgetVar="wfindExerciseGroup" modal="true" style="padding: 0px; margin: 0px;"> 
		<hmrSearch:exerciseGroupSearch handler="#{exerciseGroupBean.exerciseGroupSearch}" 	onSearchComplete="PF('wfindExerciseGroup').hide();"
			searchUpdate=":listExerciseGroupForm:exerciseGroupsTable, :growl"		showResultsPanel="false"/>
	</p:dialog>
	
	
	<p:confirmDialog message="#{msgs.DoYouReallyWantToDeleteThisEntry}"	header="#{msgs.Warning}" severity="alert" widgetVar="wconfExcExerciseGroup">
		<h:form prependId="false">
			<p:commandButton value="#{msgs.Yes}" oncomplete="wconfExcExerciseGroup.hide();"	process="@form" actionListener="#{exerciseGroupBean.deleteExerciseGroup}"
				update=":listExerciseGroupForm:exerciseGroupsTable, :growl, :content"  />
			<p:commandButton value="#{msgs.No }" onclick="wconfExcExerciseGroup.hide();"	type="button" />
		</h:form>
	</p:confirmDialog>



	<p:dialog id="exerciseDialog" header="#{msgs.Exercise}" modal="true" appendTo="@(body)" widgetVar="wexerciseDialog" style="width:90%"> 
		<hmrDetail:exerciseDetails handler="#{exerciseGroupBean.exerciseDetails}" 
			editable="false"
			intensitySummary="true" />

		<div align="left"   > 
			<p:commandButton type="button" value="#{msgs.Cancel}"		icon="ui-icon-cancel" onclick="wexerciseDialog.hide()"/>
		</div>
	</p:dialog>

	<p:dialog id="modalExerciseGroupView" appendTo="@(body)" position="left,bottom"  widgetVar="wmodalExerciseGroupView"
		header="#{msgs.ExerciseGroup}: #{exerciseGroupBean.selVersionableExerciseGroup.exerciseGroup.name} - #{msgs.Version}:  #{exerciseGroupBean.selVersionableExerciseGroup.exerciseGroup.version} " 	 >
		<h:form prependId="false">
			<p:dataTable value="#{exerciseGroupBean.selVersionableExerciseGroup.exerciseGroup.exercises}" var="exercise" paginator="true"  style="min-width:400px"
				paginatorAlwaysVisible="false"  paginatorPosition="bottom" rows="8" emptyMessage="#{msgs.NoResults}">   
				<p:columnGroup type="header" >  
					<p:row>
						<p:column colspan="6" style="text-align:center;">
							<f:facet name="header">
								<h:outputText value="#{msgs.ExerciseGroupExercises}" />
							</f:facet>
						</p:column>
					</p:row>
					<p:row>
						<p:column	colspan="2" >
							<f:facet name="header"> 
									<h:outputText value="#{msgs.Name}" style="padding-top:4px"/>
							</f:facet>
						</p:column>
						<p:column	colspan="1" style="padding:0px;margin:0px;">
							<f:facet name="header">
								<h:outputText value="#{msgs.Description}"/>
							</f:facet>
						</p:column>
						<p:column	colspan="1" style="padding:0px;margin:0px;">
							<f:facet name="header">
								<h:outputText value="#{msgs.BodyRegion}"/> 
							</f:facet>
						</p:column>
						<p:column	colspan="1" style="padding:0px;margin:0px;">
							<f:facet name="header">
								<h:outputText value="#{msgs.MuscleGroup}"/>
							</f:facet>
						</p:column>
					</p:row>	 
				</p:columnGroup>

				<p:column colspan="1" headerText="#{msgs.Name}" >
					<h:outputText value="#{exercise.name}" />
				</p:column>
	
				<p:column colspan="1" styleClass="ui-table-button-row" >
					<p:commandButton  title="#{msgs.View}" action="#{exerciseGroupBean.toViewExercise}" icon="ui-icon-search" update=":exerciseDialog" oncomplete="wexerciseDialog.show()"  styleClass="ui-table-button">
						<f:setPropertyActionListener target="#{exerciseGroupBean.exercise}" value="#{exercise}"/>
					</p:commandButton>
				</p:column> 
	
				<p:column headerText="#{msgs.Description}" >
					<h:outputText value="#{exercise.description}" />
				</p:column>		
	
				<p:column headerText="#{msgs.BodyRegion}" >
					<h:outputText value="#{exercise.bodyRegionsText}" />
				</p:column>		
	
				<p:column headerText="#{msgs.MuscleGroup}" >
					<h:outputText value="#{exercise.muscleGroupsText}" />
				</p:column>		

			</p:dataTable>			
		</h:form>
	</p:dialog>
	
</html>	